<?php /* PROJECTS $Id: do_project_aed.php,v 1.11.10.4 2006/07/25 20:24:13 merlinyoda Exp $ */

$obj = new CProject();
$msg = '';
$project_id = intval(dPgetParam($_POST, 'project_id', 0));

$results = array('success' => TRUE, 'messages' => '');
if (!$obj->load($project_id)) {
	$results['success'] = FALSE;
	$results['messages'] = 'Not found this project with id: ' . $project_id;
}
else {
	if ($msg = $obj->delete()) {
		$results['success'] = FALSE;
		$results['messages'] = implode('\n', $msg);
	} else {
		$results['success'] = TRUE;
	}
}

header('Content-Type: text/xml');

$xml = new XmlWriter();
$xml->openMemory();
$xml->startDocument('1.0', 'UTF-8');

$xml->startElement('root');

$xml->writeElement('project_iso_code', $obj->project_iso_code);
$xml->writeElement('project_id', $obj->project_id);
$xml->writeElement('success', $results['success'] ? 'true' : 'false');
$xml->writeElement('errors', $results['messages']);

$xml->endElement();

echo $xml->outputMemory(true);
?>
